﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Solidi
{
    sealed class FuncDependencyFactory<T> : GenericDependencyFactory
    {
        public override object Build(IDependencyContainer container, IDependencyKey key)
        {
            return (Func<T>)(() =>
            {
                object instance;

                container.Resolver.TryResolve(container, key, out instance);

                return (T)instance;
            });
        }
    }
}
